Carbon


SndDisposeChannel

Header: Sound.h Carbon status: Supported

Releases the memory allocated by calling the SndNewChannel function.

OSErr SndDisposeChannel (
    SndChannelPtr chan, 
    Boolean quietNow
);
Parameter descriptions
chan

A pointer to a valid sound channel structure.

quietNow

A Boolean value that indicates whether the channel should be disposed immediately (TRUE) or after sound stops playing (FALSE).

function result

A result code.

DISCUSSION

The SndDisposeChannel function disposes of the queue of sound commands associated with the sound channel specified in the chan parameter. If your application created its own sound channel structure in memory or installed a sound as a voice in a channel, the Sound Manager does not dispose of that memory. The Sound Manager also does not release memory associated with a sound resource that you have played on a channel. You might use the userInfo field of the sound channel structure to store the address of a sound handle you wish to release before disposing of the sound channel itself.

The SndDisposeChannel function can dispose of a channel immediately or wait until the queued commands are processed. If quietNow is set to TRUE, a flushCmd command and then a quietCmd command are sent to the channel bypassing the command queue. This removes all commands, stops any sound in progress, and closes the channel. If quietNow is set to FALSE, then the Sound Manager issues a quietCmd command only; it does not bypass the command queue, and it waits until the quietCmd command is processed before disposing of the channel.

SPECIAL CONSIDERATIONS

Because the SndDisposeChannel function might dispose of memory, you should not call it at interrupt time.

AVAILABILITY

Supported in Carbon. Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.


© 2000 Apple Computer, Inc. (Last Updated 6/30/2000)